package com.ihisun.tmhcms.controller.ordercontroller;

import com.ihisun.tmhcms.core.dto.orderdto.SearchOrderDto;
import com.ihisun.tmhcms.core.service.orderservice.OrderService;
import com.ihisun.tmhcms.core.vo.OrderVo;
import com.ihisun.tmhcms.utils.ResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "订单相关Api")
@RestController
@RequestMapping("/order")
public class OrderController {
    @Resource
    OrderService orderService;

    @GetMapping("/findByOrderStateCountNum")
    @ApiOperation(value = "查询订单各状态数量")
    public ResponseVo findByOrderStateCountNum() {
        return orderService.findByOrderStateCountNum();
    }

    @PostMapping("/SearchOrder")
    @ApiOperation(value ="订单列表",response = OrderVo.class)
    public ResponseVo searchOrder(@RequestBody SearchOrderDto searchOrderDto) {
        ResponseVo responseVo = orderService.SearchOrder(searchOrderDto);
        return responseVo;
    }

    @GetMapping("/orderInfo")
    @ApiOperation(value = "订单详情",response = OrderVo.class)
    @ApiImplicitParam(name = "orderId",value = "订单Id",dataType = "String",paramType = "query")
    public ResponseVo orderInfo(String orderId){
        return orderService.orderInfo(orderId);
    }

}
